package com.woniu.smallmedical.server.serverimpl;

import com.woniu.smallmedical.entity.PatientInformation;
import com.woniu.smallmedical.mapper.*;
import com.woniu.smallmedical.server.PatientInformationServer;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientInformationServerImpl implements PatientInformationServer {
    @Autowired
    PatientInformationMapper patientInformationMapper;

    @Autowired
    RegistrationMapper registrationMapper;

    @Autowired
    PrescriptionMapper prescriptionMapper;

    @Autowired
    PrescriptionDetailsMapper prescriptionDetailsMapper;

    @Autowired
    PhysiqueMapper physiqueMapper;

    @Autowired
    MedicalRecordMapper medicalRecordMapper;

    @Override
    public void addPatientInformation(PatientInformation patientInformation) {
        patientInformationMapper.addPatientInformation(patientInformation);
    }

    @Override
    public PatientInformation getPatByPatnum(int patientnumber) {
        PatientInformation patientInformation =
                patientInformationMapper.getPatByPatnum(patientnumber);
        return patientInformation;
    }

    @Override
    public PatientInformation getPatByPaid(int paid) {
        PatientInformation patByPaid = patientInformationMapper.getPatByPaid(paid);
        return patByPaid;
    }

    @Override
    public void updatePatByPaid(int sickid, PatientInformation patientInformation) {
        patientInformationMapper.updatePatByPaid(sickid,patientInformation);
    }

    @Override
    public List<PatientInformation> queryPatientInformation(String date, String search) {
        return patientInformationMapper.getPatByPatnumOrDate(date, search);
    }

    @Override
    public void deletePatientInformation(@Param("paid") int  paid) {
        patientInformationMapper.deletePatientInformation(paid);
    }

    @Override
    public void updatePatientInformation(PatientInformation patientInformation) {
        patientInformationMapper.updatePatientInformation(patientInformation);
    }

    @Override
    public void updatePatientInformationStatus(Integer id) {
        patientInformationMapper.updatePatientInformationStatus(id);
    }
}
